package com.manage.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import com.manage.entity.TrainingCourse;
import com.manage.entity.TrainingRecord;
import com.staff.entity.Staff;


@Repository
public interface TrainingCourseRepository extends PagingAndSortingRepository<TrainingCourse, Long>, JpaSpecificationExecutor<TrainingCourse> {

	@Query("from TrainingCourse tc where tc.courses.id=?1")
    public List<TrainingCourse> findTrainCourse(Long courseId);

	@Query("from TrainingRecord tr where tr.trainingCourse.id=?1")
	public List<TrainingRecord> findTrainingRecordByTrainingCourseId(Long id);
	
	@Query("from TrainingCourse tc where tc.trainName=?1")
	public List<TrainingCourse> findTrainingCourseByName(String Name);

	@Query("select count(*) From TrainingRecord tr where tr.trainingCourse.id=?1")
	public int findCount(Long id);
	
	
}

